﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Web;
using System.Configuration;
using System.Xml;


namespace Ecreate.Data.Property
{
    public class DataBaseConfigConfigHandler : IConfigurationSectionHandler
    {
        public object Create(object parent, object input, XmlNode node)
        {
            PropertyClass p = new PropertyClass();
            foreach (XmlNode childnode in node.ChildNodes)
            {
                string value = childnode.Attributes["value"].Value.ToString();
                string innerText = DataBaseConfigConfigHandler.getServerPath(childnode.InnerText);
                p.add(value, innerText);
            }
            return p;
        }


        public static string getServerPath(string path)
        {
            string innerText = path;
            if (innerText.IndexOf(ServerConst.ServerPath) > -1)
            {
                innerText = innerText.Replace(ServerConst.ServerPath, UrlManage.urlconvertor());
            }
            return innerText;

        }
    }
}
